package com.sk.ccflower.server.lib.dbUtils.sql;

import java.util.ArrayList;

import com.sk.ccflower.lib.define.DBTable;
import com.sk.ccflower.server.lib.dbBeans.CfProfileBean;
import com.sk.ccflower.server.lib.dbUtils.SQLReturn;


public class CfProfileSql extends BaseSql {
	
	private static final String m_basequery = "SELECT * FROM " + DBTable.CF_PROFILE;
	
	public CfProfileSql() throws Exception {
		super( CfProfileBean.class, "email" );		
	}
	
	@Override
	protected void clearOtherHash() {
		// TODO Auto-generated method stub
	}

	@Override
	protected void initKeyFields() throws Exception {
		// TODO Auto-generated method stub
	}

	@Override
	protected void putInOtherHash(Object data) throws Exception {
		// TODO Auto-generated method stub
	}

	public static SQLReturn getSql() {
        SQLReturn sret = new SQLReturn();
        
        sret.m_query = m_basequery;
        sret.m_params = new ArrayList<Object>();
        sret.m_class = CfProfileBean.class;
        sret.m_colMap = null;
        
        return sret;
    }
	
	public static SQLReturn getSql( String email ) {
        SQLReturn sret = new SQLReturn();
        
        sret.m_query = m_basequery + " WHERE email = '" + email + "'";
        sret.m_params = new ArrayList<Object>();
        sret.m_class = CfProfileBean.class;
        sret.m_colMap = null;
        
        return sret;
    }
	
	public static SQLReturn getSqlForLogin( String email, String passwd ) {
        SQLReturn sret = new SQLReturn();
        
        sret.m_query = m_basequery + " WHERE email=? AND passwd=?";
        sret.m_params = new ArrayList<Object>();
        sret.m_class = CfProfileBean.class;
        sret.m_colMap = null;
        sret.m_params = new ArrayList<Object>();
        sret.m_params.add( email );
        sret.m_params.add( passwd );
        
        return sret;
    }
	
	public static SQLReturn getSqlBySex( int sex ) {
        SQLReturn sret = new SQLReturn();
        
        sret.m_query = m_basequery + " WHERE sex=?";
        sret.m_params = new ArrayList<Object>();
        sret.m_class = CfProfileBean.class;
        sret.m_colMap = null;
        sret.m_params = new ArrayList<Object>();
        sret.m_params.add( sex );
        
        return sret;
    }
	
}
